<?php require_once(dirname(__FILE__)."/../config/config.php"); ?>
<?php 
if($_REQUEST['method']=="checkinvitecode")
{
	verifyinvitecode();
}
function verifyinvitecode()
{
	$code=$_REQUEST['code'];
	$lang=$_REQUEST['lang'];
	$error_message_en= "<div class='alert alert-error'>
  				<a class='close' data-dismiss='alert'>×</a>
  				<strong>We're sorry the invitation code ".$code." you entered is incorrect.</strong>
			</div>
		";
	$error_message_cn= "<div class='alert alert-error'>
  				<a class='close' data-dismiss='alert'>×</a>
  				<strong>非常抱歉,您输入的邀请码".$code."不正确.</strong>
			</div>
		";

	if($code==""){
	
		if($lang=="en"){
			echo $error_message_en;
		}
		else{
			echo $error_message_cn;
		}
		exit();
	}
	$sql="select invite_code from zy_user where invite_code='".$code."'";
	$rs=mysql_query($sql);
	$row=mysql_fetch_array($rs);
	if($row)
	{
		echo 'success';
	}else{
		
		if($lang=="en"){
			echo $error_message_en;
		}
		else{
			echo $error_message_cn;
		}
		
	}
}
?>